# -*- coding: utf-8 -*-

from PyQt5.QtWidgets import *
import sys

class Check(QWidget):
    def __init__(self):
        super(Check, self).__init__()

        layout = QFormLayout()

        self.btn1 = QCheckBox("测试按钮")
        # stateChanged信号一般在复选框的状态发生改变时发射
        self.btn1.stateChanged.connect(lambda :self.btn(self.btn1))
        layout.addWidget(self.btn1)

        self.setLayout(layout)

    def btn(self,bt):
        print(bt.text())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    check = Check().show()
    sys.exit(app.exec_())